Optimal. Leaf size=116 \[ \frac {\left (8 a^2+4 a b+b^2\right ) \sin (e+f x) \cos (e+f x)}{16 f}+\frac {1}{16} x \left (8 a^2+4 a b+b^2\right )-\frac {b (8 a+3 b) \sin (e+f x) \cos ^3(e+f x)}{24 f}-\frac {b \sin (e+f x) \cos ^5(e+f x) \left ((a+b) \tan ^2(e+f x)+a\right )}{6 f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.15, antiderivative size = 116, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3191, 413, 385, 199, 203} \[ \frac {\left (8 a^2+4 a b+b^2\right ) \sin (e+f x) \cos (e+f x)}{16 f}+\frac {1}{16} x \left (8 a^2+4 a b+b^2\right )-\frac {b (8 a+3 b) \sin (e+f x) \cos ^3(e+f x)}{24 f}-\frac {b \sin (e+f x) \cos ^5(e+f x) \left ((a+b) \tan ^2(e+f x)+a\right )}{6 f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 199
Rule 203
Rule 385
Rule 413
Rule 3191
Rubi steps
\begin {align*} \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx &=\frac {\operatorname {Subst}\left (\int \frac {\left (a+(a+b) x^2\right )^2}{\left (1+x^2\right )^4} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}+\frac {\operatorname {Subst}\left (\int \frac {a (6 a+b)+3 (a+b) (2 a+b) x^2}{\left (1+x^2\right )^3} \, dx,x,\tan (e+f x)\right )}{6 f}\\ &=-\frac {b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}+\frac {\left (8 a^2+4 a b+b^2\right ) \operatorname {Subst}\left (\int \frac {1}{\left (1+x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{8 f}\\ &=\frac {\left (8 a^2+4 a b+b^2\right ) \cos (e+f x) \sin (e+f x)}{16 f}-\frac {b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}+\frac {\left (8 a^2+4 a b+b^2\right ) \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{16 f}\\ &=\frac {1}{16} \left (8 a^2+4 a b+b^2\right ) x+\frac {\left (8 a^2+4 a b+b^2\right ) \cos (e+f x) \sin (e+f x)}{16 f}-\frac {b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 0.27, size = 79, normalized size = 0.68 \[ \frac {12 (b+(2-2 i) a) (b+(2+2 i) a) (e+f x)-3 b (4 a+b) \sin (4 (e+f x))+3 (4 a-b) (4 a+b) \sin (2 (e+f x))+b^2 \sin (6 (e+f x))}{192 f} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.42, size = 85, normalized size = 0.73 \[ \frac {3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} f x + {\left (8 \, b^{2} \cos \left (f x + e\right )^{5} - 2 \, {\left (12 \, a b + 7 \, b^{2}\right )} \cos \left (f x + e\right )^{3} + 3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{48 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.18, size = 84, normalized size = 0.72 \[ \frac {1}{16} \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} x + \frac {b^{2} \sin \left (6 \, f x + 6 \, e\right )}{192 \, f} - \frac {{\left (4 \, a b + b^{2}\right )} \sin \left (4 \, f x + 4 \, e\right )}{64 \, f} + \frac {{\left (16 \, a^{2} - b^{2}\right )} \sin \left (2 \, f x + 2 \, e\right )}{64 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.36, size = 134, normalized size = 1.16 \[ \frac {b^{2} \left (-\frac {\left (\sin ^{3}\left (f x +e \right )\right ) \left (\cos ^{3}\left (f x +e \right )\right )}{6}-\frac {\sin \left (f x +e \right ) \left (\cos ^{3}\left (f x +e \right )\right )}{8}+\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{16}+\frac {f x}{16}+\frac {e}{16}\right )+2 a b \left (-\frac {\sin \left (f x +e \right ) \left (\cos ^{3}\left (f x +e \right )\right )}{4}+\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{8}+\frac {f x}{8}+\frac {e}{8}\right )+a^{2} \left (\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.49, size = 127, normalized size = 1.09 \[ \frac {3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} {\left (f x + e\right )} + \frac {3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{5} + 8 \, {\left (6 \, a^{2} - b^{2}\right )} \tan \left (f x + e\right )^{3} + 3 \, {\left (8 \, a^{2} - 4 \, a b - b^{2}\right )} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{6} + 3 \, \tan \left (f x + e\right )^{4} + 3 \, \tan \left (f x + e\right )^{2} + 1}}{48 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 14.73, size = 120, normalized size = 1.03 \[ x\,\left (\frac {a^2}{2}+\frac {a\,b}{4}+\frac {b^2}{16}\right )+\frac {\left (\frac {a^2}{2}+\frac {a\,b}{4}+\frac {b^2}{16}\right )\,{\mathrm {tan}\left (e+f\,x\right )}^5+\left (a^2-\frac {b^2}{6}\right )\,{\mathrm {tan}\left (e+f\,x\right )}^3+\left (\frac {a^2}{2}-\frac {a\,b}{4}-\frac {b^2}{16}\right )\,\mathrm {tan}\left (e+f\,x\right )}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^6+3\,{\mathrm {tan}\left (e+f\,x\right )}^4+3\,{\mathrm {tan}\left (e+f\,x\right )}^2+1\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 4.84, size = 314, normalized size = 2.71 \[ \begin {cases} \frac {a^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} x \cos ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} + \frac {a b x \sin ^{4}{\left (e + f x \right )}}{4} + \frac {a b x \sin ^{2}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{2} + \frac {a b x \cos ^{4}{\left (e + f x \right )}}{4} + \frac {a b \sin ^{3}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{4 f} - \frac {a b \sin {\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{4 f} + \frac {b^{2} x \sin ^{6}{\left (e + f x \right )}}{16} + \frac {3 b^{2} x \sin ^{4}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{16} + \frac {3 b^{2} x \sin ^{2}{\left (e + f x \right )} \cos ^{4}{\left (e + f x \right )}}{16} + \frac {b^{2} x \cos ^{6}{\left (e + f x \right )}}{16} + \frac {b^{2} \sin ^{5}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{16 f} - \frac {b^{2} \sin ^{3}{\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{6 f} - \frac {b^{2} \sin {\left (e + f x \right )} \cos ^{5}{\left (e + f x \right )}}{16 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin ^{2}{\relax (e )}\right )^{2} \cos ^{2}{\relax (e )} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________